<template>
  <div class="com-list-item">
    <div class="list-head">
      <div class="list-logo-box">
        <img class="list-logo" :src="itemData.image" :alt="itemData.image">
        <slot />
      </div>
      <div class="list-des">
        <span class="list-name">{{itemData.name}}</span>
        <div class="list-rate">
          <span>{{itemData.rate}}.0&nbsp;分&nbsp;</span>
          <van-rate size="12" color="#46d7dc" v-model="itemData.rate" readonly/>
        </div>
        <div class="list-address" >
          <van-icon v-if="itemData.address" name="location"/>
          <span style="padding-left: 2px;">{{itemData.address}}</span>
        </div>
        <ul class="list-tags">
          <li
            v-for="(tag,index) in itemData.tags"
            :key="index">
            <van-tag round color="#f5f5f5">{{tag}}</van-tag>
          </li>
        </ul>
      </div>
      <div class="list-subscribe">
        <p><van-icon :name="attestationIcon(itemData)" size="24"></van-icon></p>
        <span v-show="itemData.subscribe">{{itemData.subscribe}}次预约</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    itemData: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    attestationIcon(item) {
      let iconPath
      if (item && item.isAttestation === true) {
        iconPath = require('../assets/images/auth.png')
      }
      return iconPath
    },
  }
}
</script>

<style lang="scss" scoped>
@import "../assets/style/global.scss";

.com-list-item {
  width: 100%;
  .list-head {
    padding: 0 12px;
    @include center;
    align-items: flex-start !important;
    .list-logo-box {
      position: relative;
      .list-logo {
        max-width: 64px;
        height: 64px;
      }
    }
    .list-des {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      padding-left: 8px;
      .list-name {
        font-size: 16px;
        font-weight: 600;
        @include ellipsis;
      }
      .list-rate {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: $colorHeadBg;
        margin-bottom: 10px;
      }
      .list-address {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: $colorHeadBg;
        span {
          color: #555;
          @include ellipsis;
        }
      }
      .list-tags {
        width: 100%;
        flex-wrap: nowrap;
        padding-top: 8px;
        box-sizing: border-box;
        @include flex(row);
        li {
          /deep/.van-tag {
            color: $colorTabBg !important;
            font-size: 10px !important;
            padding: 0 4px !important;
          }
        }
      }
    }
    .list-subscribe {
      @include flex(column);
      padding-left: 32px;
      font-size: 16px;
      color: #666;
      text-align: right;
    }
    
  }
  
}
</style>